package cn.edu.scau.cmi.linjinyong.fxml.comprehension;

import cn.edu.scau.cmi.linjinyong.client.*;
import javafx.fxml.FXML;
import javafx.scene.control.Button;
import javafx.stage.Stage;

public class ComprehensionController {
    @FXML
    private Button interProgrammingButton;
    @FXML
    private Button singletonButton;
    @FXML
    private Button multitonButton;
    @FXML
    private Button simpleFactoryMethodButton;
    @FXML
    private Button factoryButton;
    @FXML
    private Button abstractFactoryButton;
    @FXML
    private Button classAdapterButton;
    @FXML
    private Button objectAdapterButton;
    @FXML
    private Button safeComposite;
    @FXML
    private Button consistentComposite;
    @FXML
    private Button mybatisButton;
    @FXML
    private Button springButton;
    @FXML
    private Button springMybatisButton;

    @FXML
    private void interProgramming(){
        InterProgrammingClient.main(null);
    }

    @FXML
    private void singleton(){
        try {
            new SingletonClient().start(new Stage());
        } catch (Exception e) {
            e.printStackTrace();
        }
    }

    @FXML
    private void multiton(){
        try {
            new MultitonClient().start(new Stage());
        } catch (Exception e) {
            e.printStackTrace();
        }
    }

    @FXML
    private void factory(){
        try {
            new FactoryClient().start(new Stage());
        } catch (Exception e) {
            e.printStackTrace();
        }
    }

    @FXML
    private void simpleFactoryMethod(){
        try {
            new SimpleFactoryMethodClient().start(new Stage());
        } catch (Exception e) {
            e.printStackTrace();
        }
    }

    @FXML
    private void abstractFactory(){
        try {
            new AbstractFactoryClient().start(new Stage());
        } catch (Exception e) {
            e.printStackTrace();
        }
    }

    @FXML
    private void classAdapter(){
        try {
            new ClassAdapterClient().start(new Stage());
        } catch (Exception e) {
            e.printStackTrace();
        }
    }

    @FXML
    private void objectAdapter(){
        try {
            new ObjectAdapterClient().start(new Stage());
        } catch (Exception e) {
            e.printStackTrace();
        }
    }

    @FXML
    private void safeComposite(){
        try {
            new SafeCompositeClient().start(new Stage());
        } catch (Exception e) {
            e.printStackTrace();
        }
    }

    @FXML
    private void consistentComposite(){
        try {
            new ConsistentCompositeClient().start(new Stage());
        } catch (Exception e) {
            e.printStackTrace();
        }
    }

    @FXML
    private void mybatis(){
        try {
            new MybatisClient().start(new Stage());
        } catch (Exception e) {
            e.printStackTrace();
        }
    }

    @FXML
    private void spring(){
        SpringClient.main(null);
    }

    @FXML
    private void springMybatis(){
        try {
            new SpringMybatisClient().start(new Stage());
        } catch (Exception e) {
            e.printStackTrace();
        }
    }


}
